package com.songlanyun.modules.goods.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.songlanyun.common.drive.RootEntity;
import lombok.Data;

/**
 * 商家所发商品的与店铺的授权关系表，平台店铺发的商品如A,平台会有一条店铺与商品的关系，商家店铺SS也要代销平台商品，则需要建立一条商品A也商品店铺SS的关系，店铺SS可以随时上下架这个平台商品
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-05 10:01:59
 */
@Data
@TableName("yxt_product_shop_goods_relation")
public class GoodsAuthShop extends RootEntity<Long, GoodsGroupRelation> implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	@TableId
	private Long id;
	/**
	 * 所属商品
	 */
	private Long goodsId;
	/**
	 * 是否上架
	 */
	private boolean added;
	/**
	 * 上加状态的时间
	 */
	private Date addedStatusTime;


	@TableField(fill = FieldFill.INSERT)
	private Date createTime;
	/**
	 *
	 */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;
	/**
	 * 授权店铺id
	 */
	private Long authorizeShopId;
	/**
	 * 发布商品的商家店铺
	 */
	private Long publishShopId;

	@Override
	public Long getIdentity() {
		return getId();
	}

	public boolean isProxy()
	{
		return !this.getAuthorizeShopId().equals(this.getPublishShopId());
	}

	public void processAdded()
	{
		this.added = !this.added;
	}
}
